import { createRouter, createWebHistory } from 'vue-router'

import routes from './modules'

/**
 * 创建路由配置
 */
export const router = createRouter({
  history: createWebHistory(),
  routes,
  scrollBehavior(to, from, savedPosition) {
    return {
      el: '#app', top: 0, left: 0, behavior: 'smooth'
    }
  }
})



/**
 * 向Vue中设置VueRouter
 *
 * @param {Object} app VueApp
 */
export function setupRouter(app) {
  app.use(router)
}

export default router
